//
//  LBNavigationController.m
//  LvoeBeen_Imitation
//
//  Created by Mac on 17/2/18.
//  Copyright © 2017年 itcast. All rights reserved.
//

#import "LBNavigationController.h"

@interface LBNavigationController ()

@end

@implementation LBNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 调整导航栏背景色
    for (UIView *subView in self.navigationBar.subviews) {
        if ([subView isKindOfClass:NSClassFromString(@"_UIBarBackground")]) {
            
            UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 64)];
            backView.userInteractionEnabled = NO;
            backView.backgroundColor = NavigationYellowColor;
//            __weak UIView *lastView =
            [subView.subviews.lastObject insertSubview:backView aboveSubview:subView.subviews.lastObject.subviews.lastObject];
        }
    }
}

#pragma mark
#pragma mark - 重写 push 方法
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    if (self.childViewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:animated];
}

@end
